#ifndef __MYIIC_H
#define __MYIIC_H
#include "sys.h" 
 
   	   		   
//IO????
#define SDA_IN()  {GPIOB->MODER&=~(3<<(9*2));GPIOB->MODER|=0<<9*2;}	//PB9????
#define SDA_OUT() {GPIOB->MODER&=~(3<<(9*2));GPIOB->MODER|=1<<9*2;} //PB9????
//IO????	 
#define IIC_SCL    PBout(8) //SCL
#define IIC_SDA    PBout(9) //SDA	 
#define READ_SDA   PBin(9)  //??SDA 
 
//IIC??????
void IIC_Init(void);                //???IIC?IO?				 
void IIC_Start(void);				//??IIC????
void IIC_Stop(void);	  			//??IIC????
void IIC_Send_Byte(u8 txd);			//IIC??????
u8 IIC_Read_Byte(unsigned char ack);//IIC??????
u8 IIC_Wait_Ack(void); 				//IIC??ACK??
void IIC_Ack(void);					//IIC??ACK??
void IIC_NAck(void);				//IIC???ACK??
 
void IIC_Write_One_Byte(u8 daddr,u8 addr,u8 data);
u8 IIC_Read_One_Byte(u8 daddr,u8 addr);	  
#endif